source("R/utils.R")
source("R/mcmc.R")
source("R/functions.R")
source("R/monitornew.R")
load_pkgs()
zmargin <- theme(panel.spacing = grid::unit(0, "lines"))
theme_set(theme_bw())
library(targets)

fishphylo

tar_load(traceplot_ag_mcmc0)
print(traceplot_ag_mcmc0)

tar_load(ag_mcmc0)
aa <- do.call(abind, c(ag_mcmc0, list(along=3)))
aa2 <- aperm(aa,c(1,3,2), resize=TRUE)
monitor(aa2)
## Inference for the input samples (8 chains: each with iter = 8000; warmup = 0):
## 
##                   Q5  Q50  Q95 Mean   SD  Rhat Bulk_ESS Tail_ESS
## loss.sc         2.93 3.23 3.51 3.22 0.18  1.00    20667    33530
## loss.pc         4.26 4.73 5.13 4.71 0.26  1.00    15128    24480
## loss.ag_pc0_sc0 2.47 4.07 5.54 4.05 0.93  1.00     2295     5106
## gain.sc         4.91 5.13 5.34 5.13 0.13  1.00    22464    35882
## loss.ag_pc0_sc1 2.30 4.36 6.90 4.45 1.38  1.01     1137     1870
## gain.pc         3.55 3.93 4.27 3.92 0.22  1.00    15862    29335
## loss.ag_pc1_sc0 3.81 4.58 5.20 4.55 0.42  1.00     8589    16730
## loss.ag_pc1_sc1 2.12 3.59 4.78 3.54 0.81  1.00     2699     5605
## gain.ag_pc0_sc0 1.58 2.52 3.26 2.48 0.52  1.00     5264    11605
## gain.ag_pc0_sc1 0.27 1.63 2.91 1.62 0.81  1.00     1821     2496
## gain.ag_pc1_sc0 3.52 4.23 4.82 4.21 0.40  1.00     9868    16006
## gain.ag_pc1_sc1 0.93 2.68 4.27 2.65 1.01  1.01     1696     3758
## 
## For each parameter, Bulk_ESS and Tail_ESS are crude measures of 
## effective sample size for bulk and tail quantities respectively (an ESS > 100 
## per chain is considered good), and Rhat is the potential scale reduction 
## factor on rank normalized split chains (at convergence, Rhat <= 1.01).
bp2 <- ggpairs(as.data.frame(lump.mcmc.list(ag_mcmc0)), progress=FALSE,
        lower=list(continuous=function(...) my_mcmc(..., show_prior=FALSE)),
        upper=list(continuous=function(...) my_mcmc(..., geom="density", show_prior=FALSE))) +
  zmargin
bp2_time <- system.time(print(bp2))

Contour levels are: 50%, 80% 90%, 95% (largest) highest posterior density regions.

treeblock

tar_load(traceplot_ag_mcmc_tb)
print(traceplot_ag_mcmc_tb)

tar_load(ag_mcmc_tb)
aa <- do.call(abind, c(ag_mcmc_tb, list(along=3)))
aa2 <- aperm(aa,c(1,3,2), resize=TRUE)
monitor(aa2)
## Inference for the input samples (8 chains: each with iter = 8000; warmup = 0):
## 
##                   Q5  Q50  Q95 Mean   SD  Rhat Bulk_ESS Tail_ESS
## loss.sc         3.06 3.35 3.62 3.35 0.17  1.00    20376    33951
## loss.pc         4.45 4.87 5.24 4.86 0.24  1.00    14007    26347
## loss.ag_pc0_sc0 2.45 4.09 5.58 4.06 0.95  1.01     1976     4736
## gain.sc         5.03 5.23 5.43 5.23 0.12  1.00    22759    35775
## loss.ag_pc0_sc1 2.31 4.31 6.84 4.40 1.36  1.00     1127     1870
## gain.pc         3.60 3.97 4.31 3.96 0.22  1.00    20518    33001
## loss.ag_pc1_sc0 4.07 4.75 5.31 4.73 0.38  1.00    11503    16782
## loss.ag_pc1_sc1 2.25 3.73 4.94 3.68 0.82  1.00     2658     4610
## gain.ag_pc0_sc0 1.39 2.39 3.16 2.35 0.54  1.00     4853     8425
## gain.ag_pc0_sc1 0.28 1.65 2.87 1.63 0.79  1.00     1919     2646
## gain.ag_pc1_sc0 4.20 4.79 5.26 4.76 0.34  1.00    10934    11859
## gain.ag_pc1_sc1 1.02 2.80 4.37 2.76 1.02  1.00     1723     3571
## 
## For each parameter, Bulk_ESS and Tail_ESS are crude measures of 
## effective sample size for bulk and tail quantities respectively (an ESS > 100 
## per chain is considered good), and Rhat is the potential scale reduction 
## factor on rank normalized split chains (at convergence, Rhat <= 1.01).
bp3 <- ggpairs(as.data.frame(lump.mcmc.list(ag_mcmc_tb)), progress=FALSE,
        lower=list(continuous=function(...) my_mcmc(..., show_prior=FALSE)),
        upper=list(continuous=function(...) my_mcmc(..., geom="density", show_prior=FALSE))) +
  zmargin
bp3_time <- system.time(print(bp3))